# !/usr/bin/python
# generate hostinfos.xml file
import string
import random

out_file_name= "hostinfos.xml"
out_file = open(out_file_name, "w")

max_pos_x = 500
min_pos_x = 0

max_pos_y = 500
min_pos_y = 0

min_data_rate = 50
max_data_rate = 100

# the id of the hosts should be 0 ... num_hosts - 1
num_hosts = 10

out_file.write('<HostInfoList>\n')
for id in range(num_hosts):
	pos_x = random.randint(min_pos_x, max_pos_x)
	pos_y = random.randint(min_pos_y, max_pos_y)
	data_rate = random.randint(min_data_rate, max_data_rate)
	out_file.write('\t<HostInfo>\n')
	out_file.write('\t\t<ID>%d</ID>\n' % id)
	out_file.write('\t\t<PosX>%d</PosX>\n' % pos_x)
	out_file.write('\t\t<PosY>%d</PosY>\n' % pos_y)
	out_file.write('\t\t<DataRate>%d</DataRate>\n' % data_rate)
	out_file.write('\t</HostInfo>\n')
out_file.write('</HostInfoList>\n')
